bitkeeper revision 1.694 (40133166fMqipwBHlUP1QVHEO6EEOg)
authorkaf24@scramble.cl.cam.ac.uk <kaf24@scramble.cl.cam.ac.uk>
Sun, 25 Jan 2004 03:00:54 +0000 (03:00 +0000)
committerkaf24@scramble.cl.cam.ac.uk <kaf24@scramble.cl.cam.ac.uk>
Sun, 25 Jan 2004 03:00:54 +0000 (03:00 +0000)
Many files:
  From Kip Macy, we now are stricter when compiling the mini os.

14 files changed:
docs/style.tex
extras/mini-os/Makefile
extras/mini-os/h/hypervisor.h
extras/mini-os/h/lib.h
extras/mini-os/h/mm.h
extras/mini-os/h/os.h
extras/mini-os/kernel.c
extras/mini-os/lib/malloc.c
extras/mini-os/lib/math.c
extras/mini-os/lib/printf.c
extras/mini-os/lib/string.c
extras/mini-os/time.c
extras/mini-os/traps.c
xen/include/hypervisor-ifs/block.h

index de59d9a9122bf80f8c74006dca3033556df88b31..b35308ef4870245a55cb8ced222cd13433c4d11e 100644 (file)
@@ -4,7 +4,7 @@
 \setcounter{secnumdepth}{10}
 \setcounter{tocdepth}{2}
 
-\usepackage{sabon}
+%\usepackage{sabon}
 \def\textos#1{#1}
 
 %
index c0b977080bc66a443840e6bf5bc1abd9b2a0566a..2e4d08e9d0976cc6a10b4748ff1662ad4e18fad5 100644 (file)
@@ -1,17 +1,24 @@
 
 CC := gcc
 LD := ld
+
 # Linker should relocate monitor to this address
 MONITOR_BASE := 0xE0100000
-CFLAGS  := -fno-builtin -O3 -Wall -Ih/
+
+# NB. '-Wstrict-prototypes -Wredundant-decls -Wpointer-arith -Winline -ansi'
+#     might all be okay to add to Xen. '-Wnested-externs' is a maybe.
+#     '-Wcast-qual' is evil.
+CFLAGS := -fno-builtin -O3 -Wall -Ih/ -Wredundant-decls
+CFLAGS += -Wstrict-prototypes -Wnested-externs -Wpointer-arith -Winline -ansi
 
 TARGET := mini-os
 
-LOBJS:= lib/malloc.o lib/math.o lib/printf.o lib/string.o 
-OBJS := entry.o kernel.o traps.o hypervisor.o mm.o events.o time.o ${LOBJS}
+LOBJS := lib/malloc.o lib/math.o lib/printf.o lib/string.o 
+OBJS  := entry.o kernel.o traps.o hypervisor.o mm.o events.o time.o ${LOBJS}
 
 HINTF := h/hypervisor-ifs/hypervisor-if.h
-HDRS :=  h/os.h h/types.h h/hypervisor.h h/mm.h h/events.h h/time.h h/lib.h $(HINTF)
+HDRS  :=  h/os.h h/types.h h/hypervisor.h h/mm.h h/events.h h/time.h h/lib.h
+HDRS  += $(HINTF)
 
 default: $(TARGET)
 
index e07018a937832dd24429d1e39f9d20f668df197d..a4f56256929c88fd43f99c4d40001eb409e3efd8 100644 (file)
@@ -32,7 +32,7 @@ void ack_hypervisor_event(unsigned int ev);
  * Assembler stubs for hyper-calls.
  */
 
-static inline int HYPERVISOR_set_trap_table(trap_info_t *table)
+static __inline__ int HYPERVISOR_set_trap_table(trap_info_t *table)
 {
     int ret;
     __asm__ __volatile__ (
@@ -43,7 +43,7 @@ static inline int HYPERVISOR_set_trap_table(trap_info_t *table)
     return ret;
 }
 
-static inline int HYPERVISOR_mmu_update(mmu_update_t *req, int count)
+static __inline__ int HYPERVISOR_mmu_update(mmu_update_t *req, int count)
 {
     int ret;
     __asm__ __volatile__ (
@@ -54,7 +54,7 @@ static inline int HYPERVISOR_mmu_update(mmu_update_t *req, int count)
     return ret;
 }
 
-static inline int HYPERVISOR_console_write(const char *str, int count)
+static __inline__ int HYPERVISOR_console_write(const char *str, int count)
 {
     int ret;
     __asm__ __volatile__ (
@@ -66,7 +66,7 @@ static inline int HYPERVISOR_console_write(const char *str, int count)
     return ret;
 }
 
-static inline int HYPERVISOR_set_gdt(unsigned long *frame_list, int entries)
+static __inline__ int HYPERVISOR_set_gdt(unsigned long *frame_list, int entries)
 {
     int ret;
     __asm__ __volatile__ (
@@ -78,7 +78,7 @@ static inline int HYPERVISOR_set_gdt(unsigned long *frame_list, int entries)
     return ret;
 }
 
-static inline int HYPERVISOR_stack_switch(unsigned long ss, unsigned long esp)
+static __inline__ int HYPERVISOR_stack_switch(unsigned long ss, unsigned long esp)
 {
     int ret;
     __asm__ __volatile__ (
@@ -89,7 +89,7 @@ static inline int HYPERVISOR_stack_switch(unsigned long ss, unsigned long esp)
     return ret;
 }
 
-static inline int HYPERVISOR_set_callbacks(
+static __inline__ int HYPERVISOR_set_callbacks(
     unsigned long event_selector, unsigned long event_address,
     unsigned long failsafe_selector, unsigned long failsafe_address)
 {
@@ -103,7 +103,7 @@ static inline int HYPERVISOR_set_callbacks(
     return ret;
 }
 
-static inline int HYPERVISOR_net_io_op(netop_t *op)
+static __inline__ int HYPERVISOR_net_io_op(netop_t *op)
 {
     int ret;
     __asm__ __volatile__ (
@@ -114,7 +114,7 @@ static inline int HYPERVISOR_net_io_op(netop_t *op)
     return ret;
 }
 
-static inline int HYPERVISOR_fpu_taskswitch(void)
+static __inline__ int HYPERVISOR_fpu_taskswitch(void)
 {
     int ret;
     __asm__ __volatile__ (
@@ -124,7 +124,7 @@ static inline int HYPERVISOR_fpu_taskswitch(void)
     return ret;
 }
 
-static inline int HYPERVISOR_yield(void)
+static __inline__ int HYPERVISOR_yield(void)
 {
     int ret;
     __asm__ __volatile__ (
@@ -135,7 +135,7 @@ static inline int HYPERVISOR_yield(void)
     return ret;
 }
 
-static inline int HYPERVISOR_exit(void)
+static __inline__ int HYPERVISOR_exit(void)
 {
     int ret;
     __asm__ __volatile__ (
@@ -146,7 +146,7 @@ static inline int HYPERVISOR_exit(void)
     return ret;
 }
 
-static inline int HYPERVISOR_stop(void)
+static __inline__ int HYPERVISOR_stop(void)
 {
     int ret;
     __asm__ __volatile__ (
@@ -157,7 +157,7 @@ static inline int HYPERVISOR_stop(void)
     return ret;
 }
 
-static inline int HYPERVISOR_dom0_op(void *dom0_op)
+static __inline__ int HYPERVISOR_dom0_op(void *dom0_op)
 {
     int ret;
     __asm__ __volatile__ (
@@ -168,7 +168,7 @@ static inline int HYPERVISOR_dom0_op(void *dom0_op)
     return ret;
 }
 
-static inline int HYPERVISOR_network_op(void *network_op)
+static __inline__ int HYPERVISOR_network_op(void *network_op)
 {
     int ret;
     __asm__ __volatile__ (
@@ -179,7 +179,7 @@ static inline int HYPERVISOR_network_op(void *network_op)
     return ret;
 }
 
-static inline int HYPERVISOR_block_io_op(unsigned int op)
+static __inline__ int HYPERVISOR_block_io_op(unsigned int op)
 {
     int ret;
     __asm__ __volatile__ (
@@ -190,7 +190,7 @@ static inline int HYPERVISOR_block_io_op(unsigned int op)
     return ret;
 }
 
-static inline int HYPERVISOR_set_debugreg(int reg, unsigned long value)
+static __inline__ int HYPERVISOR_set_debugreg(int reg, unsigned long value)
 {
     int ret;
     __asm__ __volatile__ (
@@ -201,7 +201,7 @@ static inline int HYPERVISOR_set_debugreg(int reg, unsigned long value)
     return ret;
 }
 
-static inline unsigned long HYPERVISOR_get_debugreg(int reg)
+static __inline__ unsigned long HYPERVISOR_get_debugreg(int reg)
 {
     unsigned long ret;
     __asm__ __volatile__ (
@@ -212,7 +212,7 @@ static inline unsigned long HYPERVISOR_get_debugreg(int reg)
     return ret;
 }
 
-static inline int HYPERVISOR_update_descriptor(
+static __inline__ int HYPERVISOR_update_descriptor(
     unsigned long pa, unsigned long word1, unsigned long word2)
 {
     int ret;
@@ -224,7 +224,7 @@ static inline int HYPERVISOR_update_descriptor(
     return ret;
 }
 
-static inline int HYPERVISOR_set_fast_trap(int idx)
+static __inline__ int HYPERVISOR_set_fast_trap(int idx)
 {
     int ret;
     __asm__ __volatile__ (
@@ -235,7 +235,7 @@ static inline int HYPERVISOR_set_fast_trap(int idx)
     return ret;
 }
 
-static inline int HYPERVISOR_dom_mem_op(void *dom_mem_op)
+static __inline__ int HYPERVISOR_dom_mem_op(void *dom_mem_op)
 {
     int ret;
     __asm__ __volatile__ (
@@ -246,7 +246,7 @@ static inline int HYPERVISOR_dom_mem_op(void *dom_mem_op)
     return ret;
 }
 
-static inline int HYPERVISOR_multicall(void *call_list, int nr_calls)
+static __inline__ int HYPERVISOR_multicall(void *call_list, int nr_calls)
 {
     int ret;
     __asm__ __volatile__ (
@@ -257,7 +257,7 @@ static inline int HYPERVISOR_multicall(void *call_list, int nr_calls)
     return ret;
 }
 
-static inline long HYPERVISOR_kbd_op(unsigned char op, unsigned char val)
+static __inline__ long HYPERVISOR_kbd_op(unsigned char op, unsigned char val)
 {
     int ret;
     __asm__ __volatile__ (
@@ -268,7 +268,7 @@ static inline long HYPERVISOR_kbd_op(unsigned char op, unsigned char val)
     return ret;
 }
 
-static inline int HYPERVISOR_update_va_mapping(
+static __inline__ int HYPERVISOR_update_va_mapping(
     unsigned long page_nr, unsigned long new_val, unsigned long flags)
 {
     int ret;
index 48140ab79d31880101adc13152fb855d2afeebac..d9996a2f857c74739384189b4210bc73fb8ab229 100644 (file)
@@ -114,7 +114,7 @@ void  free(void* p);
 void *realloc(void* p, size_t n);
 void *memalign(size_t alignment, size_t n);
 void *valloc(size_t n);
-struct mallinfo mallinfo();
+struct mallinfo mallinfo(void);
 int  mallopt(int parameter_number, int parameter_value);
 
 void **independent_calloc(size_t n_elements, size_t size, void* chunks[]);
@@ -123,7 +123,7 @@ void *pvalloc(size_t n);
 void cfree(void* p);
 int malloc_trim(size_t pad);
 size_t malloc_usable_size(void* p);
-void malloc_stats();
+void malloc_stats(void);
 
 
 #endif /* _LIB_H_ */
index 466f0c3137961da119d35922299536a3b598e10d..e12b56495dc231ca1dd7f03a85e27c83430639a1 100644 (file)
 extern unsigned long *phys_to_machine_mapping;
 #define pfn_to_mfn(_pfn) (phys_to_machine_mapping[(_pfn)])
 #define mfn_to_pfn(_mfn) (machine_to_phys_mapping[(_mfn)])
-static inline unsigned long phys_to_machine(unsigned long phys)
+static __inline__ unsigned long phys_to_machine(unsigned long phys)
 {
     unsigned long machine = pfn_to_mfn(phys >> PAGE_SHIFT);
     machine = (machine << PAGE_SHIFT) | (phys & ~PAGE_MASK);
     return machine;
 }
-static inline unsigned long machine_to_phys(unsigned long machine)
+static __inline__ unsigned long machine_to_phys(unsigned long machine)
 {
     unsigned long phys = mfn_to_pfn(machine >> PAGE_SHIFT);
     phys = (phys << PAGE_SHIFT) | (machine & ~PAGE_MASK);
@@ -69,7 +69,7 @@ static inline unsigned long machine_to_phys(unsigned long machine)
 #define to_phys(x)                 ((unsigned long)(x)-VIRT_START)
 #define to_virt(x)                 ((void *)((unsigned long)(x)+VIRT_START))
 
-void init_mm();
+void init_mm(void);
 unsigned long alloc_pages(int order);
 
 #endif /* _MM_H_ */
index 9be205e00922e1ca8b101bab703944c3ca0198e1..c717b6696149cf905c06499371beab6629093c44 100644 (file)
@@ -137,8 +137,8 @@ typedef struct { volatile int counter; } atomic_t;
 #define xchg(ptr,v) \
         ((__typeof__(*(ptr)))__xchg((unsigned long)(v),(ptr),sizeof(*(ptr))))
 struct __xchg_dummy { unsigned long a[100]; };
-#define __xg(x) ((struct __xchg_dummy *)(x))
-static inline unsigned long __xchg(unsigned long x, volatile void * ptr,
+#define __xg(x) ((volatile struct __xchg_dummy *)(x))
+static __inline__ unsigned long __xchg(unsigned long x, volatile void * ptr,
                                    int size)
 {
     switch (size) {
index ca9b8f4c6bdf9c59497aad01be12abfff76aa636..4af99cdd351952e41d53c699614f6877deb587c2 100644 (file)
@@ -60,10 +60,10 @@ void failsafe_callback(void);
 static void exit_handler(int ev, struct pt_regs *regs);
 static void debug_handler(int ev, struct pt_regs *regs);
 
+extern char shared_info[PAGE_SIZE];
 
 static shared_info_t *map_shared_info(unsigned long pa)
 {
-    extern char shared_info[PAGE_SIZE];
     if ( HYPERVISOR_update_va_mapping((unsigned long)shared_info >> PAGE_SHIFT,
                                       pa | 3, UVMF_INVLPG) )
     {
index c231eb7e866b06c87c31ea0103f20fb08619dc1c..68af1581cb2a0df5748e5f7b154e343c26e78d5e 100644 (file)
@@ -60,7 +60,7 @@ static void *more_core(size_t n)
     if ( ret )
     {
         num_pages = 1 << order;
-        last = ret + (num_pages * PAGE_SIZE);
+        last = (char *)ret + (num_pages * PAGE_SIZE);
     }
 
     return ret;      
index 29e1cc933ea2b5dc820843a0d24baf1570f09b72..be08740965ebb89a91c0ec6e563bcac2c68f8b1c 100644 (file)
@@ -140,8 +140,7 @@ shl(register digit *p, register int len, register int sh)
  * leading zeros).
  */
 u64
-__qdivrem(uq, vq, arq)
-       u64 uq, vq, *arq;
+__qdivrem(u64 uq, u64 vq, u64 *arq)
 {
        union uu tmp;
        digit *u, *v, *q;
@@ -363,8 +362,7 @@ __divdi3(s64 a, s64 b)
  * Divide two unsigned quads.
  */
 u64
-__udivdi3(a, b)
-        u64 a, b;
+__udivdi3(u64 a, u64 b)
 {
         return (__qdivrem(a, b, (u64 *)0));
 }
@@ -374,8 +372,7 @@ __udivdi3(a, b)
  * Return remainder after dividing two unsigned quads.
  */
 u_quad_t
-__umoddi3(a, b)
-        u_quad_t a, b;
+__umoddi3(u_quad_t a, u_quad_t b)
 {
         u_quad_t r;
 
index bd7beba2c5d00e7e2d629c4d2bd0e71cb3b02532..698a089c180b38aa19ab9ce8a01c2db0dc8de0af 100644 (file)
@@ -130,10 +130,7 @@ vsprintf(char *buf, const char *cfmt, va_list ap)
  * The buffer pointed to by `nbuf' must have length >= MAXNBUF.
  */
 static char *
-ksprintn(nbuf, ul, base, lenp)
-       char *nbuf;
-       u_long ul;
-       int base, *lenp;
+ksprintn(char *nbuf, u_long ul, int base, int *lenp)
 {
        char *p;
 
@@ -148,10 +145,7 @@ ksprintn(nbuf, ul, base, lenp)
 }
 /* ksprintn, but for a quad_t. */
 static char *
-ksprintqn(nbuf, uq, base, lenp)
-       char *nbuf;
-       u_quad_t uq;
-       int base, *lenp;
+ksprintqn(char *nbuf, u_quad_t uq, int base, int *lenp)
 {
        char *p;
 
index c1b9dbfc8e5e34d463eb4ab6b1dfedac0d67439b..a00a861316927a52cf0e600c1db43e7189559f00 100644 (file)
@@ -35,7 +35,8 @@ int memcmp(const void * cs,const void * ct,size_t count)
 
 void * memcpy(void * dest,const void *src,size_t count)
 {
-       char *tmp = (char *) dest, *s = (char *) src;
+       char *tmp = (char *) dest;
+    const char *s = src;
 
        while (count--)
                *tmp++ = *s++;
@@ -120,7 +121,7 @@ char * strchr(const char * s, int c)
         for(; *s != (char) c; ++s)
                 if (*s == '\0')
                         return NULL;
-        return (char *) s;
+        return (char *)s;
 }
 
 char * strstr(const char * s1,const char * s2)
@@ -139,4 +140,3 @@ char * strstr(const char * s1,const char * s2)
         }
         return NULL;
 }
-
index 23b31794ba90f99af5f95eda10e8c68536c8cca8..447e1649877d3045933c36e6f5d6d3a633fa3f09 100644 (file)
@@ -88,7 +88,7 @@ static void get_time_values_from_xen(void)
     (shadow_time_version == HYPERVISOR_shared_info->time_version2)
 
 
-static inline unsigned long get_time_delta_usecs(void)
+static __inline__ unsigned long get_time_delta_usecs(void)
 {
     s32      delta_tsc;
     u32      low;
index b97f9e3bc65200084dd9e9c3d724c038369fb342..c0ef3350250ff6a04b6c335ee5b20054a4826440 100644 (file)
@@ -57,7 +57,7 @@ void dump_regs(struct pt_regs *regs)
 }      
 
 
-static inline void dump_code(unsigned eip)
+static __inline__ void dump_code(unsigned eip)
 {
   unsigned *ptr = (unsigned *)eip;
   int x;
@@ -80,7 +80,7 @@ static inline void dump_code(unsigned eip)
  * register CR2, but that is not accessible in a virtualised OS.
  */
 
-static void inline do_trap(int trapnr, char *str,
+static void __inline__ do_trap(int trapnr, char *str,
                           struct pt_regs * regs, long error_code)
 {
   printk("FATAL:  Unhandled Trap (see mini-os:traps.c)");
index 6b7840e6dc7756c8a81e1c7ccec2ca8ba65f0c13..0f0e32f66527e3784b21c153612436bf2fd21c12 100644 (file)
@@ -104,10 +104,10 @@ typedef struct xen_disk
 typedef struct xen_disk_info
 {
     /* IN variables  */
-    int         max;             // maximumum number of disks to report
-    xen_disk_t *disks;           // pointer to array of disk info 
+    int         max;             /* maximumum number of disks to report */
+    xen_disk_t *disks;           /* pointer to array of disk info       */
     /* OUT variables */
-    int         count;           // how many disks we have info about 
+    int         count;           /* how many disks we have info about   */
 } xen_disk_info_t;
 
 #endif